﻿using System.Collections.Generic;

namespace MvcForum.Net.Bussiness
{
    public class RoleRepo
    {
        public static List<Role> List()
        {
            return MainDB.Instant.Role_List().ExecuteTypedList<Role>();
        }

        public static void Save(Role r)
        {
            MainDB.Instant.Role_Save(r.RoleId, r.RoleName, r.IsAutoStart, r.IsAdmin, r.IsSuperModerator,r.AllowLogin, r.CssClass, r.AccessMask).Execute();
        }

        public static Role Info(int id)
        {
            var _data = MainDB.Instant.Role_Detail(id).ExecuteTypedList<Role>();

            return _data.Count > 0 ? _data[0] : null;

        }

        public static void Del(string ids)
        {
            MainDB.Instant.Role_Delete(ids).Execute();
        }
    }
}
